<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>审核评论</title>
    <link href="../../css/admin/style.css" rel="stylesheet" type="text/css" />
    <script src="../../js/jquery-1.8.3.min.js" type="text/javascript"></script >
    <script>
        $(function (){
            var id = location.search.split("=")[1];
            $("#id").val(id);
            $.get("../../comment/getcommentById",{id:id},function (res){
                if (res.code == 202){
                    window.parent.location.replace("../login.html");
                }else if (res.code == 500){
                    alert(res.msg);
                }else {
                    $("#account").val(res.data.user.account);
                    $("#title").val(res.data.journalism.title);
                    $("#content").val(res.data.content);
                    $("#commentTime").val(new Date(res.data.commentTime).toLocaleString());
                }
            },"json")
        })
        function updatestate(state1){
            var id = $("#id").val();
            $.get("../../comment/topass",{id:id,state:state1},function (res){
                if (res.code == 202){
                    window.parent.location.replace("../login.html");
                }else if (res.code == 500){
                    alert(res.msg);
                }else {
                    alert(res.msg);
                    location.replace("list.html");
                }
            })
        }
    </script>
</head>
<body>
<form id="formId">
    <input type="hidden" id="id" name="id"/>
    <div class="formbody">
        <div class="formtitle"><span>基本信息</span></div>
        <ul class="forminfo">
            <li>
                <label>评论人</label>
                <input id="account" name="account" type="text" class="dfinput" />
            </li>
            <li>
                <label>文章标题</label>
                <input type="text" name="title" id="title" class="dfinput"/>
            </li>
            <li>
                <label>评论内容</label>
                <input id="content" name="content" type="text" class="dfinput" />
            </li>
            <li>
                <label>评论时间</label>
                <input id="commentTime" name="commentTime" type="text" class="dfinput" />
            </li>

            <li>
                <input type="button" value="通过" onclick="updatestate(1)">
                <input type="button" value="不通过" onclick="updatestate(2)">
            </li>
        </ul>
    </div>

</form>
</body>
</html>